<template>
  <div>
    <el-row class="demo-autocomplete">
      <el-col :span="12">
        <el-autocomplete
          class="inline-input"
          v-model="state1"
          :fetch-suggestions="querySearch"
          placeholder="请输入年纪"
          @select="handleSelect"
        ></el-autocomplete>
      </el-col>
    </el-row>

    <el-button @click="change1">查找</el-button>
    <el-button @click="getWx">院系</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      jjj: [],
      wx:[],
      state1: "",
      input1: "",
      input2: "",
    };
  },
  methods: {
    querySearch(queryString, cb) {
      var queryString = this.wx;
      // 调用 callback 返回建议列表的数据
      cb(queryString);
    },
    change1() {
      this.getRequest("", this.input1).then((resp) => {
        console.log(resp);
      });
    },
    loadAll() {
      return [
        { value: "2018" },
        { value: "2019" },
        { value: "2020" },
        { value: "2021" },
      ];
    },
    getWx() {
      this.getRequest("/wework/yx/list").then((resp) => {
        let temp=resp.data.data
        for (const key in temp) {
          let o={};
          o.value=temp[key].mc;
          console.log(o);
          this.wx.push(o);
        }
      });
    },
  },
  mounted() {
    this.jjj = this.loadAll();
  },
};
</script>

<style scoped>
.el-button {
  margin-left: 10px;
}
.el-input {
  width: 200px;
}
.input-with-select .el-input-group__prepend {
  background-color: #fff;
}
</style>